﻿namespace LeetCodeProject._0001_1000._001_100._81_90._083;

public class Solution
{
    public ListNode DeleteDuplicates(ListNode head)
    {
        if (head == null)
        {
            return head;
        }

        ListNode ptr = head;
        while (ptr.next != null)
        {
            if (ptr.val == ptr.next.val)
            {
                ptr.next = ptr.next.next;
            }
            else
            {
                ptr = ptr.next;
            }
        }

        return head;
    }
}